package com.itheima.d01_properties;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;

public class Test {
    public static void main(String[] args) throws IOException {
        //
        //1.
        Properties pro = new Properties();

        //2.
        pro.load(new FileInputStream("E:\\soft_install\\ideaIU\\JavaProject\\day12_properties\\src\\com\\itheima\\d01_properties\\users.properties"));

        //3.
        //
        System.out.println(pro.getProperty("zhangsan"));
        System.out.println(pro.getProperty("lisi"));
        System.out.println(pro.getProperty("admin"));

        System.out.println(pro.get("==================="));
        //
        Set<Map.Entry<Object, Object>> entries = pro.entrySet();
        for (Map.Entry<Object, Object> entry : entries) {
            System.out.println(entry.getKey() + "=" + entry.getValue());
        }

        System.out.println("===============");
        //
        pro.forEach((k, v) -> System.out.println(k + "=" + v));


    }
}
